var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var ArticleSchema = new Schema({
    title: {
        type: String,
        trim: true,
        required: '标题不能为空'
    },
    uid: {
        type: Schema.Types.ObjectId,
        required: '用户不能为空'
    },
    username: String,
    usericon: String,
    userdep: String,

    date: {
        type: Date,
        default: Date.now
    },
    visited: {
        type: Number,
        default: 0
    },
    loved: {
        type: Number,
        default: 0
    },
    collected: {
        type: Number,
        default: 0
    },
    content: {
        type: String,
        required: '正文不能为空'
    },
    classify: {
        type: Number,
        default: 0
    },
    tags: [String],
    comments: [Schema.Types.ObjectId]
});

mongoose.model('Article', ArticleSchema);

console.log('Article模型已经建立...');
